package com.boot.learning.mockito.mongo;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.ApiOperation;

/**
 * 用户详情controller （Mongo）
 * @version 1.0
 * @author fuhw
 */
@RestController
@RequestMapping("/userdetails/v1")
public class UserDetailControler {
	
	@Autowired
	private UserDetailService userdetailService;
	
	@GetMapping
    @ApiOperation(value="获取所有用户")
	public List<UserDetail> findAll() {
		return userdetailService.findAll();
	}
	
	@PostMapping
    @ApiOperation(value="添加用户")
	public UserDetail addUser(@RequestBody UserDetail userDetail) {
		return userdetailService.addUser(userDetail);
	}
}
